function searchSports(fieldSports){
	var msg='Eu pratico:';
	if (fieldSports.indexOf('Futebol')!=-1){
		msg+=' Futebol';
	}
	if (fieldSports.indexOf('Natação')!=-1){
		msg+=' Natação';
	}
	if (fieldSports.indexOf('Vôlei')!=-1){
		msg+=' Vôlei';
	}
	document.getElementById('mySports').innerHTML=msg;  
};

function loadSports() {
  var params = {};
  params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [opensocial.Person.Field.SPORTS];
  var req = opensocial.newDataRequest();
  req.add(req.newFetchPersonRequest('VIEWER', params), 'viewer');
  req.send(onLoadSports);
};

function onLoadSports(data) {
	var viewer = data.get('viewer').getData();
	var fieldSports = viewer.getField(opensocial.Person.Field.SPORTS);
	
	document.getElementById('fieldSports').innerHTML = fieldSports;
	searchSports(fieldSports);
};

function init() {
    loadSports();
};
